package cn.dev.mybatis.proxy;

import java.lang.reflect.Proxy;
import java.sql.Connection;

public class ProxyFactory {
    private ProxyFactory() {
    }

    @SuppressWarnings("unchecked")
    public static <T> T getProxyObject(Class<T> clazz, Connection connection, boolean autoCommit) {
        return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class[]{clazz}, new JdkProxy(connection, autoCommit));
    }
}
